﻿using RuoVea.ExSugar.Attributes;
using RuoVea.ExSugar.Entity;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace RuoVea.OmiApi.Log.Entitys;

/// <summary>
/// 异常日志
/// </summary>
[SugarTable(nameof(SysLogEx), "异常日志")]
[Description("异常日志")]
[Tenant("0")]
public class SysLogEx : AutoKeyBase
{
    /// <summary>
    /// 操作人
    /// </summary>
    [MaxLength(20)]
    [ConfigSugarColumn(columnKey: nameof(Account), columnDescription:"操作人", IsNullable = true)]
    public string Account { get; set; }

    /// <summary>
    /// 名称
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(Name), columnDescription:"名称", IsNullable = true)]
    public string Name { get; set; }

    /// <summary>
    /// 类名
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(ClassName), columnDescription:"类名", IsNullable = true)]
    public string ClassName { get; set; }

    /// <summary>
    /// 方法名
    /// </summary>
    [MaxLength(100)]
    [ConfigSugarColumn(columnKey: nameof(MethodName), columnDescription:"方法名", IsNullable = true)]
    public string MethodName { get; set; }

    /// <summary>
    /// 异常名称
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ExceptionName), columnDescription:"异常名称", IsNullable = true)]
    public string ExceptionName { get; set; }

    /// <summary>
    /// 异常信息
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ExceptionMsg), columnDescription:"异常信息", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string ExceptionMsg { get; set; }

    /// <summary>
    /// 异常源
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ExceptionSource), columnDescription:"异常源", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string ExceptionSource { get; set; }

    /// <summary>
    /// 堆栈信息
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(StackTrace), columnDescription:"堆栈信息", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string StackTrace { get; set; }

    /// <summary>
    /// 参数对象
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ParamsObj), columnDescription:"参数对象", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string ParamsObj { get; set; }

    /// <summary>
    /// 异常时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(ExceptionTime), columnDescription:"异常时间", IsNullable = true)]
    public DateTime ExceptionTime { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [ConfigSugarColumn(columnKey: nameof(CreateTime), columnDescription:"创建时间", IsOnlyIgnoreUpdate = true)]
    public virtual DateTime? CreateTime { get; set; }
}
